<?php
/**
 * 网站编辑
 */
$title = '网站编辑';
include "header.php";
$pref = explode('/', $_SERVER['REQUEST_URI'])[1];
?>
<div class="row">
    <div class="col-xl-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-12">
                        <h3 class="mb-3 header-title text-success"><?= $title ?></h3>
                        <form class="form-horizontal layui-form">
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站名称</label>
                                <input type="text" name="sitename" lay-verify="required"
                                       class="form-control" value="<?= $conf['sitename'] ?>" placeholder="请输入站点名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站副标题</label>
                                <input type="text" name="title" lay-verify="required"
                                       class="form-control" value="<?= $conf['title'] ?>" placeholder="请输入网址副标题">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站关键词</label>
                                <input type="text" name="keywords" lay-verify="required"
                                       class="form-control" value="<?= $conf['keywords'] ?>" placeholder="请输入站点名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站描述语</label>
                                <input type="text" name="description" lay-verify="required"
                                       class="form-control" value="<?= $conf['description'] ?>" placeholder="请输入站点名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">客服QQ</label>
                                <input type="text" name="kfqq" lay-verify="required"
                                       class="form-control" value="<?= $conf['kfqq'] ?>" placeholder="请输入客服QQ">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">官方群链接</label>
                                <input type="text" name="Communication" lay-verify="required"
                                       class="form-control" value="<?= $conf['Communication'] ?>"
                                       placeholder="请输入官方群链接">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">邀请奖励</label>
                                <input type="text" name="award" lay-verify="required"
                                       class="form-control" value="<?= $conf['award'] ?>"
                                       placeholder="每邀请1人奖励的<?= $conf['currency'] ?>数量">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">货币名称</label>
                                <input type="text" name="currency" lay-verify="required"
                                       class="form-control" value="<?= $conf['currency'] ?>" placeholder="网站货币的名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">签到赠送</label>
                                <input type="text" name="Signin" lay-verify="required"
                                       class="form-control" value="<?= $conf['Signin'] ?>"
                                       placeholder="每天签到奖励的<?= $conf['currency'] ?>数量">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">免费商品或积分商品每日兑换限制<font
                                            color="red">(单一用户)</font></label>
                                <input type="text" name="getinreturn" lay-verify="required"
                                       class="form-control" value="<?= $conf['getinreturn'] ?>"
                                       placeholder="每日单一用户可用积分兑换商品的次数(包含免费商品)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">免费商品或积分商品每日兑换限制<font
                                            color="red">(整个站点)</font></label>
                                <input type="text" name="getinreturn_all" lay-verify="required"
                                       class="form-control" value="<?= $conf['getinreturn_all'] ?>"
                                       placeholder="每日整个网站可用积分兑换商品的次数(包含免费商品)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">API对接密钥</label>
                                <input type="text" name="secret" lay-verify="required"
                                       class="form-control" value="<?= $conf['secret'] ?>"
                                       placeholder="调用后台接口时使用！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">下单违禁词 <font color="red">(若下单信息中包含下列关键词则无法购买商品,多个请使用英文逗号分割)</font></label>
                                <input type="text" name="blacklist"
                                       class="form-control" value="<?= $conf['blacklist'] ?>"
                                       placeholder="请使用英文逗号分割！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">安全中心 <font color="red">关闭后不再记录用户访问日志,需安装对应插件</font></label>
                                <select class="custom-select mt-3" name="SecurityCenter">
                                    <option <?= $conf['SecurityCenter'] == 1 ? 'selected' : '' ?> value="1">开启整站日志监控
                                    </option>
                                    <option <?= $conf['SecurityCenter'] == -1 ? 'selected' : '' ?> value="-1">关闭整站日志监控
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">代付款分享语句 <font color="red">可用参数：[url]
                                        = 付款链接</font></label>
                                <input type="text" name="share_url" lay-verify="required"
                                       class="form-control" value="<?= $conf['share_url'] ?>"
                                       placeholder="[url] = 付款链接">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">logo地址</label>
                                <div class="input-group">
                                    <input type="text" lay-verify="required" lay-verType="tips"
                                           class="form-control" name="logo" id="image" value="<?= $conf['logo'] ?>"
                                           placeholder="网站logo的地址"/>
                                    <div class="input-group-append">
                                                <span class="input-group-text" id="upload"
                                                      style="cursor: pointer">上传</span>
                                    </div>
                                    <div class="input-group-append">
                                                <span class="input-group-text"
                                                      onclick="layer.alert('<img src=\''+$('#image').val()+'\' style=width:100%  />')"
                                                      style="cursor: pointer;background-color: slateblue;color: white">预览</span>
                                    </div>
                                    <div class="input-group-append">
                                        <a href="http://cdn.vue8.cn/s/pieoksig"
                                           target="_blank" class="input-group-text"
                                           style="cursor: pointer;background-color: #a8f46b;color: white">图库</a>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">商品分享海报获取方式 <font color="red">
                                        云端可生成多种随机样式 </font></label>
                                <select class="custom-select mt-3" name="share_image">
                                    <option <?= $conf['share_image'] == 1 ? 'selected' : '' ?> value="1">本地生成
                                    </option>
                                    <option <?= $conf['share_image'] == 2 ? 'selected' : '' ?> value="2">云端生成
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">启用订单队列 <font color="red">
                                        订单队列可有效缓解服务器压力,购物车付款默认开启！ </font></label>
                                <select class="custom-select mt-3" name="OredeQueue">
                                    <option <?= $conf['OredeQueue'] == 1 ? 'selected' : '' ?> value="1">不启用订单队列,下单后直接对接到货源
                                    </option>
                                    <option <?= $conf['OredeQueue'] == 2 ? 'selected' : '' ?> value="2">启用订单队列,先加入队列后对接货源
                                    </option>
                                </select>
                            </div>


                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">上传图片压缩比例 <font color="red">0.1=压缩到10%,1=不压缩</font></label>
                                <input type="text" name="compression" lay-verify="required"
                                       class="form-control" value="<?= $conf['compression'] ?>"
                                       placeholder="图片上传压缩比例,0.1=压缩到10%,1=不压缩">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">防重复订单配置(秒数限制) <font
                                            color="red">商品ID,下单信息,下单份数,全部相同则判断为同一订单!防止重复写入创建重复订单!</font></label>
                                <input type="text" name="OrderAstrict" lay-verify="required"
                                       class="form-control" value="<?= $conf['OrderAstrict'] ?>"
                                       placeholder="同信息商品下单间隔秒数(商品ID,下单信息,下单份数相同的订单)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">强制用户登陆 <font color="red">
                                        开启后用户必须登陆用户后台才可以购买商品！ </font></label>
                                <select class="custom-select mt-3" name="ForcedLanding">
                                    <option <?= $conf['ForcedLanding'] == 1 ? 'selected' : '' ?> value="1">不开启用户强制登陆
                                    </option>
                                    <option <?= $conf['ForcedLanding'] == 2 ? 'selected' : '' ?> value="2">开启用户强制登陆
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">购物车开关 <font color="red">
                                        关闭后用户无法向购物车添加商品 </font></label>
                                <select class="custom-select mt-3" name="CartState">
                                    <option <?= $conf['CartState'] == 1 ? 'selected' : '' ?> value="1">开启购物车
                                    </option>
                                    <option <?= $conf['CartState'] == 2 ? 'selected' : '' ?> value="2">关闭购物车
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">下单失败后状态 <font color="red">
                                        包括但不限于,货源对接失败,自营商品下单,卡密商品发卡失败,api商品对接失败等所有失败状态！ </font></label>
                                <select class="custom-select mt-3" name="SubmitState">
                                    <option <?= $conf['SubmitState'] == 1 ? 'selected' : '' ?> value="1">已完成
                                    </option>
                                    <option <?= $conf['SubmitState'] == 2 ? 'selected' : '' ?> value="2">待处理
                                    </option>
                                    <option <?= $conf['SubmitState'] == 3 ? 'selected' : '' ?> value="3">异常中
                                    </option>
                                    <option <?= $conf['SubmitState'] == 4 ? 'selected' : '' ?> value="4">正在处理
                                    </option>
                                    <option <?= $conf['SubmitState'] == 5 ? 'selected' : '' ?> value="5">退款
                                    </option>
                                    <option <?= $conf['SubmitState'] == 6 ? 'selected' : '' ?> value="6">已评价(完结订单,无法申请售后)
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">首页数据缓存周期 <font color="red">整站每隔多少秒获取一次最新数据?,商品价格监控不受影响</font></label>
                                <input type="text" name="Homecaching" lay-verify="required"
                                       class="form-control" value="<?= $conf['Homecaching'] ?>"
                                       placeholder="首页分类,商品详细信息等杂七杂八的数据缓存周期">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">保底销量 <font color="red">
                                        销量数量计算规则：保底销量+真实销量</font></label>
                                <input type="text" name="SalesSum" lay-verify="required"
                                       class="form-control" value="<?= $conf['SalesSum'] ?>"
                                       placeholder="销量数量计算规则：保底销量+真实销量">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">是否允许在QQ或微信内打开网站?</label>
                                <select class="custom-select mt-3" name="WeixQqValidation">
                                    <option <?= $conf['WeixQqValidation'] == 1 ? 'selected' : '' ?> value="1">不允许
                                    </option>
                                    <option <?= $conf['WeixQqValidation'] == 2 ? 'selected' : '' ?> value="2">允许
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">关闭网站 <font color="red">
                                        可填写关闭网站的原因,留空不关闭网站，只影响商城首页！</font></label>
                                <input type="text" name="CloseWebsite"
                                       class="form-control" value="<?= $conf['CloseWebsite'] ?>"
                                       placeholder="关闭网站的原因,留空不关站">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">腾讯云智服sign <font color="red">
                                        留空不显示</font>
                                    <a href="https://yzf.qq.com/" target="_blank">获取地址</a>
                                    <a href="javascript:layer.alert('第一步：点击旁边的获取地址进入云智服官网<br>第二步：注册,注册需要微信<br>第三步：登陆后台,登陆后可看提示操作<br>第四步：点击顶部设置按钮,渠道按钮选择网站渠道<br>第五步：点击新增网站按钮填写信息,填写完毕后可看到部署界面！<br>第六步：在链接地址里面找到你自己的sign！<br>如：https://yzf.qq.com/xv/web/static/chat/index.html?sign=长长的混合字符串<br>把sign后面的字符串复制下来,填在这里就行了！',{title:'云智服sign获取教程'})"
                                       style="color: #0bedcf">获取教程</a>
                                    <a href="https://yzf.qq.com/xv/html/admin/chat/home" target="_blank">会话管理地址</a>
                                </label>
                                <input type="text" name="YzfSign"
                                       class="form-control" value="<?= $conf['YzfSign'] ?>"
                                       placeholder="留空不显示！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal"
                                       style="font-weight: 500">是否开启APP模板商品购买页相关推荐(同分类商品)?</label>
                                <select class="custom-select mt-3" name="GoodsRecommendation">
                                    <option <?= $conf['GoodsRecommendation'] == 1 ? 'selected' : '' ?> value="1">开启
                                    </option>
                                    <option <?= $conf['GoodsRecommendation'] == 2 ? 'selected' : '' ?> value="2">关闭
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">目录保护 <font color="red">
                                        可填写后台目录保护后缀，留空不开启，登陆时访问：<?= is_https(false) . href() . '/' . $pref . '/' . ($conf['Protect'] == '' ? '' : '?' . $conf['Protect']) ?>
                                        才可打开登陆界面！</font></label>
                                <input type="text" name="Protect"
                                       class="form-control" value="<?= $conf['Protect'] ?>"
                                       placeholder="目录保护后缀，留空不保护！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">首页默认显示商品类型 <font color="red">固定排序会获取排序最靠前的分类商品</font></label>
                                <select class="custom-select mt-3" name="HomePageDisplay">
                                    <option <?= $conf['HomePageDisplay'] == 1 ? 'selected' : '' ?> value="1">固定展示，方便排序（会匹配排序最高的分类里面的商品！）
                                    </option>
                                    <option <?= $conf['HomePageDisplay'] == 2 ? 'selected' : '' ?> value="2">随机展示，每次随机抽取28条商品数据，销量越高越靠前！
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">用户账户密码登陆/注册</label>
                                <select class="custom-select mt-3" name="AccountPasswordLogin">
                                    <option <?= $conf['AccountPasswordLogin'] == 1 ? 'selected' : '' ?> value="1">开启
                                    </option>
                                    <option <?= $conf['AccountPasswordLogin'] == 2 ? 'selected' : '' ?> value="2">关闭
                                    </option>
                                </select>
                            </div>


                            <button type="submit" lay-submit lay-filter="Web_editor"
                                    class="btn btn-block btn-xs btn-success">保存内容
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<?php include "bottom.php"; ?>

<script>
    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(Web_editor)', function (data) {
            layer.alert('是否要执行当前操作？', {
                icon: 3, btn: ['确定', '取消'], btn1: function (layero, index) {
                    var index = layer.msg('数据保存中,请稍后...', {icon: 16, time: 999999});
                    $.post('ajax.php?act=config_set', data.field, function (res) {
                        if (res.code == 1) {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        } else {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function (layero, index) {
                                    location.reload();
                                }
                            });
                        }
                    });
                }
            });
            return false;
        })
    });
    layui.use(['upload', 'form'], function () {
        var upload = layui.upload;
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            , url: 'ajax.php?act=image_up' //上传接口
            , done: function (res, index, upload) {
                layer.msg('图片上传成功');
                $("#image").val(res.src);
                $("#image_base").attr('src', res.src);
            }
            , error: function () {
                layer.msg('图片上传失败!')
            }
        });
    });
</script>


